#!/usr/bin/env python
# -*- coding:utf-8 -*-
# @FileName  :Watch_30.py
# @Time      :2020/6/23 14:42
# @Author    :Administrator


import time

print('按下回车开始计时，按下Ctrl+c停止计时.')
while True:
    input("")
    starttime = time.time()
    print('开始')
    try:
        while True:
            print('计时： ', round(time.time() - starttime, 0), '秒', end="\r")
            time.sleep(1)
    except KeyboardInterrupt:
        print("结束")
        endtime = time.time()
        print('总共的时间为:', round(endtime - starttime, 2), 'secs')
        break

